import { BaseEntity } from '../../base/entity/base';
import { Column, Entity, Index } from 'typeorm';

/**
 * 商品信息
 */
@Entity('product_product')
export class ProductProductEntity extends BaseEntity {
  @Index()
  @Column({ comment: '名称', length: 255, nullable: true })
  name: string;

  @Index()
  @Column({ comment: '品牌ID', nullable: true })
  brandId: number;

  @Index()
  @Column({ comment: '采购人ID', nullable: true })
  purchaserId: number;

  @Column({ comment: '采购时间', type: 'datetime', nullable: true })
  purchasingTime: Date;

  @Column({ comment: '产品类型', dict: 'productCategory', nullable: true })
  productCategory: number;

  @Column({ comment: '库存类型', dict: 'stockCategory', nullable: true })
  stockCategory: number;

  @Column({ comment: '商品系列', dict: 'Series', nullable: true })
  series: number;

  @Column({ comment: '系列ID', type: 'bigint', nullable: true })
  seriesId: number;

  @Column({ comment: '型号', nullable: true })
  modelNumber: string;

  @Column({ comment: '折射率', type: 'decimal', precision: 10, scale: 4, nullable: true })
  refraction: number;

  @Column({ comment: '焦点', nullable: true})
  focus: number;

  @Column({ comment: '功能类型', dict: 'functionType', nullable: true })
  functionType: number;

  @Column({ comment: '材料', dict: 'material', nullable: true })
  material: number;

  @Column({ comment: '设计', dict: 'design', nullable: true })
  design: number;

  @Column({ comment: '规格', dict: 'specifications', nullable: true })
  specifications: string;

  @Column({ comment: '膜层', dict: 'film', nullable: true })
  film: number;

  @Column({ comment: '单位', dict: 'unit', nullable: true })
  unit: number;

  @Column({ comment: '库存', nullable: true })
  stock: number;

  @Column({ comment: '最低库存', nullable: true })
  lastStock: number;

  @Column({ comment: '报警天数', nullable: true })
  alarmDays: number;

  @Column({ comment: '备注', nullable: true })
  remark: string;

  @Column({ comment: '拼音码', nullable: true })
  pyCode: string;

  @Column({ comment: '价格', type: 'decimal', precision: 10, scale: 2, nullable: true })
  price: number;

  @Column({ comment: '训练次数', default: 0, nullable: true })
  trainCount: number;

  @Column({ comment: '赠送次数', default: 0, nullable: true })
  giftCount: number;

  @Column({ comment: '商品状态', dict: ['在售', '下架'], default: 0, nullable: true })
  status: number;

  @Column({ comment: '转化类型', dict: ['不计算', '计算'], default: 1 })
  convertType: number;

  @Column({ comment: '商品描述', type: 'text', nullable: true })
  description: string;

  @Column({ comment: '主图', nullable: true })
  mainImage: string;

  @Column({ comment: '详情图', type: 'json', nullable: true })
  detailImages: string[];
}
